bitkeeper revision 1.1740 (42ba88cewc_4MMbiCLInZ8gEcgqwhQ)
authorarun.sharma@intel.com[kaf24] <arun.sharma@intel.com[kaf24]>
Thu, 23 Jun 2005 10:02:54 +0000 (10:02 +0000)
committerarun.sharma@intel.com[kaf24] <arun.sharma@intel.com[kaf24]>
Thu, 23 Jun 2005 10:02:54 +0000 (10:02 +0000)
[PATCH] vmx-pit-reset2.patch

A VMX guest can reprogram the same PIT channel twice. We should not create
two ac_timers to handle this case.

Signed-off-by: Edwin Zhai <edwin.zhai@intel.com>
Signed-off-by: Arun Sharma <arun.sharma@intel.com>
xen/arch/x86/vmx_intercept.c

index cd7e46490455f122ba251a4327b8c754020889b5..e64b626d290f87a65a8a07068286b4493c66fbb7 100644 (file)
@@ -214,6 +214,14 @@ void vmx_hooks_assist(struct vcpu *d)
 
     /* load init count*/
     if (p->state == STATE_IORESP_HOOK) { 
+        /* set up actimer, handle re-init */
+        if ( active_ac_timer(&(vpit->pit_timer)) ) {
+            VMX_DBG_LOG(DBG_LEVEL_1, "VMX_PIT: guest reset PIT with channel %lx!\n", (unsigned long) ((p->u.data >> 24) & 0x3) );
+            rem_ac_timer(&(vpit->pit_timer));
+        }
+        else
+            init_ac_timer(&vpit->pit_timer, pit_timer_fn, vpit, 0);
+
         /* init count for this channel */
         vpit->init_val = (p->u.data & 0xFFFF) ; 
         /* frequency(ms) of pit */
@@ -248,9 +256,7 @@ void vmx_hooks_assist(struct vcpu *d)
 
         vpit->intr_bitmap = intr;
 
-        /* set up the actimer */
-        init_ac_timer(&vpit->pit_timer, pit_timer_fn, vpit, 0);
-        pit_timer_fn(vpit); /* timer seed */
+       set_ac_timer(&vpit->pit_timer, NOW() + MILLISECS(vpit->period));
 
         /*restore the state*/
         p->state = STATE_IORESP_READY;